package sf.model.fields;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public abstract class RegexConstrainedFieldModel extends AbstractFieldModel
{

	Pattern pattern;
	Matcher matcher;

	public boolean check(String s)
	{
		matcher.reset(s);
		return matcher.matches();
	}

	public void setPatternByString(String p)
	{
		pattern = Pattern.compile(p);
		matcher = pattern.matcher("");
	}

}
